package chatclient.netio;




import chatclient.tools.ChatException;
import chatclient.netio.ClientAttr;
import chatclient.netio.Attr;
import chatclient.netio.AttrList;
import java.io.*;

public class Command extends Message {

    public Command() {
    }

    public Command(byte byte0) {
        super(byte0);
    }

    public Command(byte byte0, AttrList attrlist) {
        super(byte0, attrlist);
    }

    public Command(InputStream inputstream)
            throws ChatException, IOException {
        super(inputstream);
    }

    public Command(Reader reader)
            throws ChatException, IOException {
        super(names, reader);
    }

    @Override
    protected Attr getAttrProto() {
        return proto;
    }

    @Override
    public Object clone() {
        return new Command(getId(), (AttrList) getParams().clone());
    }

    @Override
    public String getName() {
        return getName(names);
    }

    public static byte getId(String s) {
        for (byte byte0 = 0; byte0 < names.length; byte0++) {
            if (s.equalsIgnoreCase(names[byte0])) {
                return byte0;
            }
        }

        return -1;
    }

    public static String getName(byte byte0) {
        return byte0 >= names.length ? Integer.toString(byte0) : names[byte0];
    }

    @Override
    public String toString() {
        return super.toString("Command ", names);
    }
    private static final Attr proto = ClientAttr.getProto();
    public static final byte NUL = 0;
    public static final byte PING = 1;
    public static final byte SIGNUP = 2;
    public static final byte NOTE = 3;
    public static final byte NICKLIST = 4;
    public static final byte CHANNELLIST = 5;
    public static final byte JOIN = 6;
    public static final byte PART = 7;
    public static final byte REHASH = 8;
    public static final byte GETUSERINFO = 9;
    public static final byte GETINFO = 9;
    public static final byte SETUSERINFO = 10;
    public static final byte SETINFO = 10;
    public static final byte KICK = 11;
    public static final byte BAN = 12;
    public static final byte QUIT = 13;    
    public static final byte UNBAN = 14;
    public static final byte BANLIST = 15;
    public static final byte GETVAR = 16;
    public static final byte GETPERMS = 17;
    public static final byte GIVEPERMS = 18;
    public static final byte TAKEPERMS = 19;
    public static final byte ENQUEUE = 20;
    public static final byte DEQUEUE = 21;
    public static final byte FINDNICKS = 22;
    public static final byte SETACCOUNT = 23;
    public static final byte PROXYLIST = 24;
    public static final byte KILLCHANNEL = 25;
    public static final byte SETPROFILE = 26;
    public static final byte GETPROFILE = 27;
    public static final byte RESPONSE = 28;
    public static final byte AUTOQUEUE = 29;
    public static final byte EXEC = 30;
    public static final byte GETLOG = 31;
    public static final byte REQUESTIGNORE = 32;
    public static final byte REQUESTPRIVATE = 33;
    public static final byte COLORUSE = 34;
    private static final String names[] = {
        "NUL", "PING", "SIGNUP", "NOTE", "NICKLIST", "CHANNELLIST", "JOIN", "PART", "REHASH", "GETINFO",
        "SETINFO", "KICK", "BAN", "QUIT", "UNBAN", "BANLIST", "GETVAR", "GETPERMS", "GIVEPERMS", "TAKEPERMS",
        "ENQUEUE", "DEQUEUE", "FINDNICKS", "SETACCOUNT", "PROXYLIST", "KILLCHANNEL", "SETPROFILE", "GETPROFILE", "RESPONSE", "AUTOQUEUE",
        "EXEC", "GETLOG", "REQUESTIGNORE", "REQUESTPRIVATE", "COLORUSE"
    };
}
